﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using EZCRS.HCMS.Bll;
using EZCRS.HCMS.Entity;
using System.Text;
using EZCRS.HCMS.Web;

namespace EZCRS.HCMS.Web.manage.hotel
{
    public partial class ajaxselect : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params.Get("t") != null)
            {
                if (Request.Params.Get("t").Trim() == "aircity")
                {
                    GetAirCity();
                }
                else
                {
                    Response.Write("");
                }
            }
        }

        private void GetAirCity()
        {
            StringBuilder str = new StringBuilder();
            string city = "";
            string airportcode = "";
            string s = "";
            try
            {
                s = this.Request.Params.Get("s");
                city = this.Request.Params.Get("k");
                city = CFun.VerifySQL(city);
                List<HCRS_Aircode> _aircode = new Bll.baseinfo.BllAirCode().getallitem(city);
                if (_aircode.Count==0)
                {
                    Response.Write("<li onfocus=\"DataFocus('" + s + "',['','']);\"  onselect=\"DataSelect('" + s + "',['','']);\"><span></span>暂无符合条件的记录！</li>");
                    return;
                }

                foreach (HCRS_Aircode _code in _aircode)
                {
                    str.Append("<li    onselect=\"DataSelect('" + s + "',['" + _code.code + "','" + _code.name + "']);\" onfocus=\"DataFocus('" + s + "',['" + _code.code + "','" + _code.name + "']);\";><span>" + _code.name_e + "</span>" + _code.code + "&nbsp;" + _code.name + "</li>");
                }
                Response.Write(str.ToString());
            }
            catch (Exception)
            {
                Response.Write("<li onfocus=\"DataFocus(['','']);\" ><span></span>暂无符合条件的记录！</li>");
            }
        }
    }
}
